﻿using Autodesk.Revit.DB;
using NPOI.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZhuXingFamilys.ExportExcel.utils;

namespace ZhuXingFamilys.ExportExcel.entity
{
	public class Rules : INotifyPropertyChanged
	{
		public event PropertyChangedEventHandler PropertyChanged;
		private int _ruleID;
		private int _nodeID;
		private string _nodeName;
		private string _ruleDesc;
		private int _opt;
		private string _optDesc;
		private int _isSelected;
		private string _selectedOptDesc;
		private string _builtInCategory1;
		private string _builtInCategory2;
		private string _deduction;
		private string _userName;
		private bool _change = false;

		private List<string> _optDescList;

		public Rules()
		{
			_ruleID = RuleID;
			_nodeID = NodeID;
			_nodeName = NodeName;
			_ruleDesc = RuleDesc;
			_opt = Opt;
			_optDesc = OptDesc;
			_isSelected = IsSelected;
			_selectedOptDesc = SelectedOptDesc;
			_builtInCategory1 = BuiltInCategory1;
			_builtInCategory2 = BuiltInCategory2;
			_deduction = Deduction;
			_userName = UserName;
			_change = Change;
			_optDescList = OptDescList;
		}
		[ExcelColumn("RuleID")]
		public int RuleID
		{
			get { return _ruleID; }
			set
			{
				_ruleID = value;
				PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("RuleID"));
			}
		}
		[ExcelColumn("NodeID")]
		public int NodeID
		{
			get { return _nodeID; }
			set
			{
				_nodeID = value;
				PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("NodeID"));
			}
		}
		[ExcelColumn("NodeName")]
		public string NodeName
		{
			get { return _nodeName; }
			set
			{
				_nodeName = value;
				PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("NodeName"));
			}
		}
		[ExcelColumn("RuleDesc")]
		public string RuleDesc
		{
			get { return _ruleDesc; }
			set
			{
				_ruleDesc = value;
				PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("RuleDesc"));
			}
		}
		[ExcelColumn("Opt")]
		public int Opt
		{
			get { return _opt; }
			set
			{
				_opt = value;
				PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Opt"));
			}
		}
		[ExcelColumn("OptDesc")]
		public string OptDesc
		{
			get { return _optDesc; }
			set
			{
				_optDesc = value;
				PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("OptDesc"));
			}
		}
		[ExcelColumn("IsSelected")]
		public int IsSelected
		{
			get { return _isSelected; }
			set
			{
				_isSelected = value;
				PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("IsSelected"));
			}
		}
		[ExcelColumn("SelectedOptDesc")]
		public string SelectedOptDesc
		{
			get { return _selectedOptDesc; }
			set
			{
				_selectedOptDesc = value;
				PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("SelectedOptDesc"));
			}
		}
		[ExcelColumn("BuiltInCategory1")]
		public string BuiltInCategory1
		{
			get { return _builtInCategory1; }
			set
			{
				_builtInCategory1 = value;
				PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("BuiltInCategory1"));
			}
		}
		[ExcelColumn("BuiltInCategory2")]
		public string BuiltInCategory2
		{
			get { return _builtInCategory2; }
			set
			{
				_builtInCategory2 = value;
				PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("BuiltInCategory2"));
			}
		}
		[ExcelColumn("Deduction")]
		public string Deduction
		{
			get { return _deduction; }
			set
			{
				_deduction = value;
				PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Deduction"));
			}
		}
		[ExcelColumn("UserName")]
		public string UserName
		{
			get { return _userName; }
			set
			{
				_userName = value;
				PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("UserName"));
			}
		}
		public bool Change
		{
			get { return _change; }
			set
			{
				_change = value;
				PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Change"));
			}
		}
		public List<string> OptDescList
		{
			get { return _optDescList; }
			set
			{
				_optDescList = value;
				PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("OptDescList"));
			}
		}


		public override bool Equals(object obj)
		{
			if (obj == null || GetType() != obj.GetType())
			{
				return false;
			}
			Rules r = (Rules)obj;
			if (r.RuleID == RuleID && r.NodeID == this.NodeID)
			{
				return true;
			}
			return false;
		}
		public override int GetHashCode()
		{
			return base.GetHashCode();
		}
	}
}
